Alter the caption text format for services.

"(Twitter) knu" -> "Twitter: knu"

Akinori MUSHA 10 lat temu
rodzic
commit
082cffce5f
2 zmienionych plików z 5 dodań i 1 usunięć
  1. 4 0
      app/helpers/application_helper.rb
  2. 1 1
      app/views/agents/_oauth_dropdown.html.erb

+ 4 - 0
app/helpers/application_helper.rb

@@ -60,4 +60,8 @@ module ApplicationHelper
60 60
       content_tag(:span, "Authenticate with #{omniauth_provider_name(provider)}")
61 61
     ].join.html_safe, user_omniauth_authorize_path(provider), class: "btn btn-default btn-service service-#{provider}"
62 62
   end
63
+
64
+  def service_label_text(service)
65
+    "#{omniauth_provider_name(service.provider)} - #{service.name}"
66
+  end
63 67
 end

+ 1 - 1
app/views/agents/_oauth_dropdown.html.erb

@@ -1,6 +1,6 @@
1 1
 <% if agent.try(:oauthable?) %>
2 2
   <div class="form-group type-select">
3 3
     <%= label_tag :service %>
4
-    <%= select_tag 'agent[service_id]', options_for_select(agent.valid_services_for(current_user).collect { |s| ["(#{s.provider}) #{s.name}", s.id]}, agent.service_id), class: 'form-control' %>
4
+    <%= select_tag 'agent[service_id]', options_for_select(agent.valid_services_for(current_user).collect { |s| [service_label_text(s), s.id] }, agent.service_id), class: 'form-control' %>
5 5
   </div>
6 6
 <% end %>